﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<CRM.Database.Model.Equipments>>" %>


<script type="text/javascript">
//<![CDATA[
   

    function OnSelectionChangedInEquipments(gridView, e) {
        if (e.isSelected) {
              var index = e.visibleIndex;
              var key = gridView.GetRowKey(e.visibleIndex);

              gridView.GetRowValues(index, 'IdEquipmentType;IdVendor;Model', UpdateText);
            
          //  UpdateText(index);
              //  alert(key);
            return key;

        }

        return -1;
    }

    function UpdateText(text) {

       // alert(idEquipment);

      //  alert(text[1]);
        
        checkComboBox.SetText(text);
    }
    
    
    
    
   
// ]]> 
</script>


<%--<% Html.DevExpress().DropDownEdit(settings =>
                                        {
                                            settings.Name = "checkComboBox";
                                            settings.SkinID = "CheckComboBox";
                                            
                                            
                                            settings.Width = 210;
                                            settings.Properties.DropDownWindowStyle.BackColor = Color.FromArgb(0xEDEDED);
                                            

                                            settings.SetDropDownWindowTemplateContent(c =>
                                                                                          {

                                                                                              Html.RenderPartial("EquipmentList",DB.EquipmentsActive);

                                                                                              ViewContext.Writer.Write("<table style=\"width:100%\"><tr><td align=\"right\">");
                                                                                              Html.DevExpress().Button(
                                                                                                  buttonSettings =>
                                                                                                  {
                                                                                                      buttonSettings.Name = "buttonClose";
                                                                                                      buttonSettings.Text = "Close";
                                                                                                      buttonSettings.Style.Add("float", "right");
                                                                                                      buttonSettings.ClientSideEvents.Click = "function(s, e){ checkComboBox.HideDropDown(); callbackPanel.RerformCallback(); }";
                                                                                                  }
                                                                                              )
                                                                                              .Render();
                                                                                              ViewContext.Writer.Write("</td></tr></table>");

                                                                                          });

                                            settings.Properties.EnableAnimation = true;
                                        
                                        }).GetHtml();%>--%>


                                <%--        <% Html.DevExpress().CallbackPanel(
        st => {
            st.Name = "callbackPanel";
            st.ClientSideEvents.BeginCallback = "function(s,e){e.customArgs['additionalParameters'] = 54;}";
            st.CallbackRouteValues = new { Controller = "GetEquipment", Action = "CallbackPanelPartial" };
            st.SetContent(() => 
            {
                Html.DevExpress().DropDownEdit(settings =>
                {
                    settings.Name = "checkComboBox";
                    settings.SkinID = "CheckComboBox";


                    settings.Width = 210;
                    settings.Properties.DropDownWindowStyle.BackColor = Color.FromArgb(0xEDEDED);


                    settings.SetDropDownWindowTemplateContent(c =>
                    {

                        Html.RenderPartial("EquipmentList", DB.EquipmentsActive);

                        ViewContext.Writer.Write("<table style=\"width:100%\"><tr><td align=\"right\">");
                        Html.DevExpress().Button(
                            buttonSettings =>
                            {
                                buttonSettings.Name = "buttonClose";
                                buttonSettings.Text = "Close";
                                buttonSettings.Style.Add("float", "right");
                                buttonSettings.ClientSideEvents.Click = "function(s, e){ checkComboBox.HideDropDown(); callbackPanel.RerformCallback(); }";
                            }
                        )
                        .Render();
                        ViewContext.Writer.Write("</td></tr></table>");

                    });

                    settings.Properties.EnableAnimation = true;

                }).GetHtml();
             });
        }
    )
    .GetHtml(); %>--%>